package com.gy.universities.service.impl;
import com.gy.universities.dao.StudyLearnprogressMapper;
import com.gy.universities.entity.StudyLearnprogress;
import com.gy.universities.service.StudyLearnprogressService;
//import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;

@Component
@Service
public class StudyLearnprogressServiceImpl implements StudyLearnprogressService {

    @Resource
    private StudyLearnprogressMapper studyLearnprogressMapper;

    public StudyLearnprogress getStudyLearnprogressById(String id)throws Exception{
        return studyLearnprogressMapper.getStudyLearnprogressById(id);
    }

    public List<StudyLearnprogress>	getStudyLearnprogressListByMap(Map<String,Object> param)throws Exception{
        return studyLearnprogressMapper.getStudyLearnprogressListByMap(param);
    }

    public Integer getStudyLearnprogressCountByMap(Map<String,Object> param)throws Exception{
        return studyLearnprogressMapper.getStudyLearnprogressCountByMap(param);
    }

    public Integer qdtxAddStudyLearnprogress(StudyLearnprogress studyLearnprogress)throws Exception{
            //studyLearnprogress.setCreatedTime(new Date());
            return studyLearnprogressMapper.insertStudyLearnprogress(studyLearnprogress);
    }

    public Integer qdtxModifyStudyLearnprogress(StudyLearnprogress studyLearnprogress)throws Exception{
        //studyLearnprogress.setUpdatedTime(new Date());
        return studyLearnprogressMapper.updateStudyLearnprogress(studyLearnprogress);
    }

    public Integer qdtxDeleteStudyLearnprogressById(String id)throws Exception{
        return studyLearnprogressMapper.deleteStudyLearnprogressById(id);
    }

    public Integer qdtxBatchDeleteStudyLearnprogress(String ids)throws Exception{
        Map<String,List<String>> param=new HashMap<String,List<String>>();
        String[] paramArrays=ids.split(",");
        List<String> idList=new ArrayList<String>();
            for (String temp:paramArrays){
                idList.add(temp);
            }
        param.put("ids",idList);
        return studyLearnprogressMapper.batchDeleteStudyLearnprogress(param);
    }


}
